#ifndef THREAD_QUEUE_H
#define THREAD_QUEUE_H
#include <qmutex.h>
#include <qqueue.h>

template<class T>
class ThreadQueue
{
public:
	bool isEmpty()
	{
	    return queue.isEmpty();
	}

	void append(const T& value)
	{
		mutex.lock();
	    queue.append(value);
		mutex.unlock();
	}

	T get()
	{
	    T value;
		mutex.lock();
		value = queue.dequeue();
		mutex.unlock();
		return value;
	}

private:
	QMutex mutex;
	QQueue<T> queue;
};

#endif
